1 /***
2 * This is a simple implementation
3 * of the StatementSegment.
4 *
5 * If you want timing, you will need
6 * to subclass this, and implement
7 * getTimes() yourself.
8 */
9
10 package junit.quilt.framework;
11
12 import java.util.List;
13 import java.util.Iterator;
14
15 public class StatementSegmentImpl
16 extends CoverageSegmentImpl
17 implements StatementSegment
18 {
19 private String FILENAME;
20 private int START;
21 private int END;
22
23 public StatementSegmentImpl( String fileName,
24 int startLine,
25 int endLine )
26 {
27 this.FILENAME = fileName;
28 this.START = startLine;
29 this.END = endLine;
30 }
31
32 // StatementSegment
33 public String getFileName() {
34 return FILENAME;
35 }
36
37 public int getLineStart() {
38 return START;
39 }
40
41 public int getLineEnd() {
42 return END;
43 }
44
45 public String getCustomXML() {
46 StringBuffer RC = new StringBuffer("");
47 RC.append("<File>" + FILENAME + "</File>");
48 RC.append("<LineFrom>" + START + "</LineFrom>");
49 RC.append("<LineTo>" + END + "</LineTo>");
50
51 return RC.toString();
52 }
53
54 public String getDescription() {
55 if (START == END) {
56 return "Line " + START + " in file " + FILENAME;
57 } else {
58 return "Lines " + START + " to " + END + " in file " + FILENAME;
59 }
60 }
61 }
This page was automatically generated by Maven